/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.serli.sample.person.model.service.ejb;

import com.serli.sample.person.model.data.Gender;
import com.serli.sample.person.model.data.Person;
import com.serli.sample.person.model.service.PeopleServiceRemote;
import com.serli.sample.person.model.data.session.PeopleBeanLocal;
import java.util.Date;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Remote;
import javax.ejb.Stateless;

/**
 * Un service EJB remote permettant de manipuler les données d'un 
 * objet de type <code>Person</code>.
 * 
 * @author serli
 */
@Stateless
@Remote(value={PeopleServiceRemote.class})

public class PeopleService  implements PeopleServiceRemote {

    @EJB
    PeopleBeanLocal personBean = null;
    
    
    @Override
    public void insert(Person person) {
        personBean.insert(person);
    }
    
    @Override
    public void delete(Person person) {
        personBean.delete(person);
    }
    
    @Override
    public List<Person> getAllOrderByFirstName() {
        return personBean.getAllOrderByFirstName();
    }

    @Override
    public void testRemoteSetPerson(Person person) {
        System.out.println(person.toString());
    }

    @Override
    public Person testRemoteGetPerson() {
        return new Person("TestFirstName", "TestLastName", new Date(), Gender.MALE);
    }    
    
    @Override
    public Object testRemoteObject(Object obj) {
        return obj;
    }

    @Override
    public int testRemotePrimitif(int i) {
        return i;
    }


}